home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / sources.lha / sources / comp / assembler / as_open.t < prev    next >
Text File  |  1988-02-05  |  2KB  |  67 lines

  1. (herald (assembler as_open t 0))
  2.  
  3. ;;; Copyright (c) 1985 Yale University
  4. ;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
  5. ;;; This material was developed by the T Project at the Yale University Computer 
  6. ;;; Science Department.  Permission to copy this software, to redistribute it, 
  7. ;;; and to use it for any purpose is granted, subject to the following restric-
  8. ;;; tions and understandings.
  9. ;;; 1. Any copy made of this software must include this copyright notice in full.
  10. ;;; 2. Users of this software agree to make their best efforts (a) to return
  11. ;;;    to the T Project at Yale any improvements or extensions that they make,
  12. ;;;    so that these may be included in future releases; and (b) to inform
  13. ;;;    the T Project of noteworthy uses of this software.
  14. ;;; 3. All materials developed as a consequence of the use of this software
  15. ;;;    shall duly acknowledge such use, in accordance with the usual standards
  16. ;;;    of acknowledging credit in academic research.
  17. ;;; 4. Yale has made no warrantee or representation that the operation of
  18. ;;;    this software will be error-free, and Yale is under no obligation to
  19. ;;;    provide any services, by way of maintenance, update, or otherwise.
  20. ;;; 5. In conjunction with products arising from the use of this material,
  21. ;;;    there shall be no use of the name of the Yale University nor of any
  22. ;;;    adaptation thereof in any advertising, promotional, or sales literature
  23. ;;;    without prior written consent from Yale in each case.
  24. ;;;
  25.  
  26.  
  27. ;;; FIELD SIZE UTILITIES
  28. ;;; The assembler itself uses these, but machine descriptions
  29. ;;; may also make use of them.
  30.  
  31. (define-integrable (fx-lessp x y z)
  32.   (and (fixnum? y) (fx<= x y) (fx< y z)))
  33.  
  34. (define-integrable (8bit? n)
  35.   (fx-lessp -128 n 128))
  36.  
  37. ;;; n is an address in bits
  38. (define-integrable (8bit-in-bits? n)
  39.   (fx-lessp -1024 n 1024))
  40.  
  41. (define-integrable (16bit? n)
  42.   (fx-lessp #x-8000 n #x8000))
  43.  
  44. ;;; n is an address in bits
  45. (define-integrable (16bit-in-bits? n)
  46.   (fx-lessp #x-40000 n #x40000))
  47.  
  48. (define-integrable (8bit-u? n)
  49.   (fx-lessp -1 n #x100))
  50.  
  51. (define-integrable (16bit-u? n)
  52.   (fx-lessp -1 n #x10000))
  53.  
  54. ;;; Used in listing, & in bits.
  55.  
  56. (define-integrable (fixnum-floor x y)
  57.   (fx- x (fixnum-mod x y)))
  58.  
  59. (define-integrable (fixnum-ceiling x y)
  60.   (fixnum-floor (fx+ x (fx- y 1)) y))
  61.  
  62. (define-integrable (fixnum-maximum x y)
  63.   (if (fx> x y) x y))
  64.  
  65.  
  66.  
  67.